package edu.smxy.associationmanagement.services.activity.impl;

import edu.smxy.associationmanagement.domain.Activity;
import edu.smxy.associationmanagement.mapper.ActivityMapper;
import edu.smxy.associationmanagement.services.activity.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * ActivityServiceImpl 服务层接口实现类
 *
 * @date 2019/04/18
 * @author: : SDH
 * @description: Activity 服务层接口实现类
 */
@Service("ActivityService")
public class ActivityServiceImpl implements ActivityService {
  @Autowired ActivityMapper activityMapper;
  /**
   * 根据活动id删除活动
   *
   * @param id 活动id
   * @return 数据库受影响的行数
   */
  @Override
  public int deleteByPrimaryKey(final Integer id) {
    return this.activityMapper.deleteByPrimaryKey(id);
  }
  /**
   * 插入活动
   *
   * @param record Activity 对象
   * @return 数据库受影响的函数
   */
  @Override
  public int insert(final Activity record) {
    return this.activityMapper.insert(record);
  }
  /**
   * 安全插入的方法
   *
   * @param record Activity 对象
   * @return 数据库受影响的函数
   */
  @Override
  public int insertSelective(final Activity record) {
    return this.activityMapper.insertSelective(record);
  }
  /**
   * 根据id查询Activity对象
   *
   * @param id Activity id
   * @return Activity对象
   */
  @Override
  public Activity selectByPrimaryKey(final Integer id) {
    return this.activityMapper.selectByPrimaryKey(id);
  }
  /**
   * 安全更新Activity数据
   *
   * @param record Activity对象
   * @return 数据库受影响的行数
   */
  @Override
  public int updateByPrimaryKeySelective(final Activity record) {
    return this.activityMapper.updateByPrimaryKeySelective(record);
  }
  /**
   * 更新Activity数据
   *
   * @param record Activity对象
   * @return 数据库受影响的行数
   */
  @Override
  public int updateByPrimaryKey(final Activity record) {
    return this.activityMapper.updateByPrimaryKey(record);
  }

  /**
   * 通过协会id获得该协会创建的所有活动信息
   *
   * @param assid 协会id
   * @return List<Activity> Activity集合
   */
  @Override
  public List<Activity> getAllActivityByAssid(final Integer assid) {
    return this.activityMapper.getAllActivityByAssid(assid);
  }

  /**
   * 获得所有活动数据
   *
   * @return List<Activity>所有Activity的集合
   */
  @Override
  public List<Activity> getAllActivity() {
    return this.activityMapper.getAllActivity();
  }
}
